<?php
/**
 *
 * @Author nikm $
 *
 * @Date 2012-01-01 $
 */

if(!defined('FROM_INDEX')) exit('Invalid request');

require ROOT_PATH.'module/admin/master.mod.php';

class moduleObj extends masterObj
{
	var $ioHandler = '';
	
	function __construct($request)
	{
		parent::__construct($request);

		require_once ROOT_PATH.'lib/io.han.php';
		$this->ioHandler = new IoHandler();
		
		$this->excute();
	}
	
	private function excute()
	{
		ob_start();
		
		switch($this->act)
		{
			case 'template':
				$this->clearTemplate();
				break;
			case 'mem':
				$this->clearMem();
				break;
			default:
				$this->main();
				break;
		}
		
		$body = ob_get_clean();
		
		$this->showBody($body);
	}
	
	private function main()
	{
		cache_clear();
		$this->ioHandler->ClearDir(ROOT_PATH.'data/cache/');		
		$this->Messager("数据缓存及模板缓存已清空", null);
	}
	
	private function clearTemplate()
	{
		$this->ioHandler->ClearDir(ROOT_PATH.'data/cache/');		
		$this->Messager("模板缓存已清空", null);
	}
	
	private function clearMem()
	{
		cache_clear();
		$this->Messager("数据缓存已清空", null);
	}
}